#include "NGameEntity.h"
#include "NComponent.h"
#include "NRenderComponent.h"

using namespace Game;

RTTI_DEFINITIONS(NGameEntity)

NGameEntity::NGameEntity(void)
	:NEntity()
{
}

NGameEntity::~NGameEntity(void)
{
}

void NGameEntity::Initialize()
{
	for(unsigned i = 0; i < mComponents.size(); i++)
	{
		mComponents[i]->Initialize(this);
	}
	
	BeginCollision = &NGameEntity::InitialCollision;
	EndCollision = &NGameEntity::EndOfCollision;
}

void NGameEntity::Update(float deltaTime)
{
	for(unsigned i = 0; i < mComponents.size(); i++)
	{
		mComponents[i]->Update(deltaTime);
	}
}

void NGameEntity::InitialCollision(void*)
{
}

void NGameEntity::EndOfCollision(void*)
{
}

void NGameEntity::AddComponent(Game::NComponent* component)
{
	component->Initialize(this);
	mComponents.push_back(component);
}

void NGameEntity::RemoveComponets()
{

}

int NGameEntity::Serialize(Core::NArchive ar)
{
	int status = NEntity::Serialize(ar);

	return status;
}

int NGameEntity::Deserialize(Core::NArchive ar)
{
	int status = NEntity::Deserialize(ar);

	return status;
}